home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / mis_cnvt / hex_dec / aehex.prg
Text File  |  1990-04-25  |  780b  |  31 lines

  1. * CLIPPER UDF - HEX to Decimal
  2. * Brought to you by Auto Exec BBS - (508) 833-0508 - 1.2 Gigabyte
  3. *                                 Specializing in CLIPPER/dbase/Foxbase/'C'
  4. * 6 Nodes
  5. * Only Registration required to download 450k/Day.
  6. *
  7. **************************************************************************
  8. Clear
  9. hexn=space(4)
  10. @1,10 say "Enter Hex Number: " get hexn picture "@!"
  11. read
  12. Dec=DecEquiv(Hexn)
  13. @3,10 say "Decimal Equivalent is: "+str(dec)
  14. return
  15.  
  16.  
  17. FUNCTION DECEQUIV
  18. Parameters Hexn
  19. private Ans, AllHex, N1, N2, N3, N4
  20. AllHex="123456789ABCDEF"
  21. N1=AT(SUBSTR(HexN,1,1),AllHex)
  22. N2=AT(SUBSTR(HexN,2,1),AllHex)
  23. N3=AT(SUBSTR(HexN,3,1),AllHex)
  24. N4=AT(SUBSTR(HexN,4,1),AllHex)
  25. Ans=(N1*4096)+(N2*256)+(N3*16)+N4
  26. Return(Ans)
  27.  
  28. ***** Eof DecEquiv
  29.  
  30.  
  31.